




/*
*************************************************************************
*西瑞克斯研发管理系统
*版 本: 1.0   
*日 期：02/15/2012    
*作 者： 王浩 QQ：873987060   
*************************************************************************   
*/ 
package com.application.yfprojectdesign.struts.actions;
import java.io.File;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionRedirect;
import org.apache.struts.actions.DispatchAction;

import com.application.attachment.entity.Attachment;
import com.application.attachment.service.AttachmentService;
import com.application.attachment.struts.form.AttachmentForm;
import com.application.usertable.entity.Usertable;
import com.application.yfexamine.entity.YfExmaine;
import com.application.yfexamine.service.YfExmaineService;
import com.application.yfexamine.struts.form.YfExmaineForm;
import com.application.yfprojectapproval.entity.YfProjectApproval;
import com.application.yfprojectapproval.struts.form.YfProjectApprovalForm;
import com.application.yfprojectdesign.commons.Constants;
import com.application.yfprojectdesign.entity.YfProjectDesign;
import com.application.yfprojectdesign.service.YfProjectDesignService;
import com.application.yfprojectdesign.struts.form.YfProjectDesignForm;
import com.manager.commons.CommonUtil;
import com.manager.commons.DisplayTagPageBean;
import com.manager.commons.RandomKey;
import com.manager.commons.page.PageBean;
import com.manager.workflow.WorkFlowConstants;
import com.manager.workflow.core.WorkFlowCommon;
import com.manager.workflow.core.YfWorkFlowDefine;
 /**
 * 
 * Description:YfProjectDesignAction<br />
 * 
 * Version:V0.1<br />
 * 
 * Author: 王浩 QQ：873987060    <br />
 * 
 * History: <br />
 * 
 * 02/15/2012 
 * 
 */
public class YfProjectDesignAction extends DispatchAction
{
       
       /**
	 * Service层实例
	 */
	private YfProjectDesignService yfProjectDesignService;
	
	private AttachmentService attachmentService;

	private WorkFlowCommon workFlowCommon;
	
	private YfExmaineService yfExmaineService;
	
	/**
	 * 日志
	 */
	private Logger log = Logger.getLogger(this.getClass());

	/**
	 * 实体对象
	 */
        private YfProjectDesign yfProjectDesign;


        /**
	 * 采用partialList方式分页程序
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public ActionForward getYfProjectDesignPartialList(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		log.debug("searchYfProjectDesign" + "开始");
		YfProjectDesignForm yfProjectDesign = (YfProjectDesignForm)form;
		if(yfProjectDesign.getDesignType()==null){
			Long designType = Long.valueOf(request.getParameter("designType"));
			yfProjectDesign.setDesignType(designType);
		}
		if(yfProjectDesign.getChildType()==null && request.getParameter("childType")!=null){
			Long childType = Long.valueOf(request.getParameter("childType"));
			yfProjectDesign.setChildType(childType);
		}
		// 统计总记录数的sql语句
		int resultSize = 0;
		// 初始化pageBean供分页所用
		PageBean pageBean = null;
		// 取得当前页list数据
		List yfProjectDesignList = null;
		resultSize = yfProjectDesignService.getAllCountYfProjectDesign(yfProjectDesign);
		pageBean = PageBean.getPageBean("yfProjectDesignTab", resultSize,request);
		yfProjectDesignList = yfProjectDesignService.searchYfProjectDesign(yfProjectDesign,pageBean);
		request.setAttribute("yfProjectDesignList", yfProjectDesignList);
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		log.debug("searchYfProjectDesign" + "结束");

		return mapping.findForward(Constants.SUCCESS);
	}

        /**
	 * 到达新增页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward toAddYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("toAddYfProjectDesigns");
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesignForm.setId(RandomKey.generateID_Long_19());
		yfProjectDesignForm.setRname(CommonUtil.getCurrentUser(request).getRname());
		yfProjectDesignForm.setProjectManager(CommonUtil.getCurrentUser(request).getId());
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		return mapping.findForward(Constants.SUCCESS);
	}

	/**
	 * 增加
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward addYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("addYfProjectDesigns");
		YfProjectDesign yfProjectDesign = this.getYfProjectDesign(form);
		 yfProjectDesign.setOperateid(CommonUtil.getCurrentUser(request).getId());
		 yfProjectDesign.setCreateDate(new Date());
		 yfProjectDesign.setAuditStatus(WorkFlowConstants.AUDIT_STATUS_1);
		this.yfProjectDesignService.insertObject(yfProjectDesign);
		ActionRedirect redirect = new ActionRedirect(mapping.findForward(Constants.SUCCESS)); 
	    redirect.addParameter("designType", yfProjectDesign.getDesignType());
	    redirect.addParameter("childType", yfProjectDesign.getChildType());
	    return redirect;
	}
        
	/**
	 * 删除
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward deleteYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("deleteYfProjectDesigns");
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		this.yfProjectDesignService.deleteYfProjectDesigns(yfProjectDesignForm);
		String serverPath=CommonUtil.ATTACHE_FILE;
		if(StringUtils.isBlank(serverPath)){
			serverPath=request.getSession().getServletContext().getRealPath("/"); 
		}
		AttachmentForm attachmentForm = new AttachmentForm();
		attachmentForm.setFid(yfProjectDesignForm.getId().toString());
		if(yfProjectDesignForm.getDesignType().longValue() == 0l){
			attachmentForm.setType(com.manager.commons.Constants.FJ_TYPE_GYSJ);
		}
		if(yfProjectDesignForm.getChildType().longValue() == 0l){
			attachmentForm.setType(com.manager.commons.Constants.FJ_TYPE_YJXXSJ);
		}
		if(yfProjectDesignForm.getChildType().longValue() == 1l){
			attachmentForm.setType(com.manager.commons.Constants.FJ_TYPE_RJXXSJ);
		}
		if(yfProjectDesignForm.getChildType().longValue() == 2l){
			attachmentForm.setType(com.manager.commons.Constants.FJ_TYPE_JKXXSJ);
		}
		List<Attachment> attachment = attachmentService.queryAttachment(attachmentForm);
		if(attachment!=null && attachment.size()>0){
			for (Attachment attachment2 : attachment) {
				File file = new File(serverPath + attachment2.getUrl());
		        file.delete();
				attachmentService.deleteObject(attachment2);
				
			}
		}
		ActionRedirect redirect = new ActionRedirect(mapping.findForward(Constants.SUCCESS)); 
	    redirect.addParameter("designType", yfProjectDesignForm.getDesignType());
	    redirect.addParameter("childType", yfProjectDesignForm.getChildType());
	    return redirect;
	}

	/**
	 * 到达更新页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward toUpdateYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("toUpdateYfProjectDesigns");
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesign = this.yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		request.setAttribute(Constants.YFPROJECTDESIGN, yfProjectDesign);
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		return mapping.findForward(Constants.SUCCESS);
	}

        
	/**
	 * 更新
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward updateYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("updateYfProjectDesigns");
		YfProjectDesign yfProjectDesign = this.getYfProjectDesign(form);
	        yfProjectDesign.setOperateid(CommonUtil.getCurrentUser(request).getId());
		 yfProjectDesign.setCreateDate(new Date());
		this.yfProjectDesignService.updateObject(yfProjectDesign);
		ActionRedirect redirect = new ActionRedirect(mapping.findForward(Constants.SUCCESS)); 
	    redirect.addParameter("designType", yfProjectDesign.getDesignType());
	    redirect.addParameter("childType", yfProjectDesign.getChildType());
	    return redirect;
	}
        
	/**
	 * 查看页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward viewYfProjectDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		log.debug("viewYfProjectDesign");

		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesign = this.yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		request.setAttribute(Constants.YFPROJECTDESIGN, yfProjectDesign);
		String processId = yfProjectDesign.getProcessId();
		if(StringUtils.isNotBlank(processId)){
			examineList(processId,yfExmaineService,request);
		}
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		return mapping.findForward(Constants.SUCCESS);
	}

	// get--set
	/**
	 * @return the YfProjectDesignService
	 */
	public YfProjectDesignService getYfProjectDesignService() {
		return this.yfProjectDesignService;
	}

	/**
	 * @param YfProjectDesignService
	 *  the YfProjectDesignService to set
	 */
	public void setYfProjectDesignService(YfProjectDesignService yfProjectDesignService) {
		this.yfProjectDesignService = yfProjectDesignService;
	}

	/**
	 * 获取YfProjectDesign实体
	 * @param ActionForm
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 * @return the YfProjectDesign
	 */
	public YfProjectDesign getYfProjectDesign(ActionForm form) throws IllegalAccessException, InvocationTargetException {
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesign = new YfProjectDesign();
		BeanUtils.copyProperties(yfProjectDesign, yfProjectDesignForm);
		return yfProjectDesign;
	}
	
	
	
	/**
	 * 提交审核
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward submitWorkFlowYfProjectDesign(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		log.debug("submitWorkFlowYfProjectDesign");
		String submitType = request.getParameter("submitType");
		//新增界面直接提交
		if(StringUtils.isNotBlank(submitType) && "add".equals(submitType)){
		    yfProjectDesign = this.getYfProjectDesign(form);
		    yfProjectDesign.setOperateid(CommonUtil.getCurrentUser(request).getId());
		    yfProjectDesign.setCreateDate(new Date());
			this.yfProjectDesignService.insertObject(yfProjectDesign);
		}
		if(StringUtils.isNotBlank(submitType) && "update".equals(submitType)){
		
			 yfProjectDesign = this.getYfProjectDesign(form);
				YfProjectDesignForm tempForm = new YfProjectDesignForm();
				tempForm.setId(yfProjectDesign.getId());
				YfProjectDesign old = yfProjectDesignService.searchYfProjectDesign(tempForm,null).get(0);
				yfProjectDesign.setProjectType(old.getProjectType());
				yfProjectDesign.setProjectOrg(old.getProjectName());
		}else{
			YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
			yfProjectDesign = yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		}
		Map<String,String> mapVar = new HashMap<String,String>();
		mapVar.put("bussId", yfProjectDesign.getId().toString());
		String bussType ="0";
		if(yfProjectDesign.getDesignType().longValue() == 0l){
			bussType =  WorkFlowConstants.BUSS_TYPE_GYSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 0l){
			bussType =  WorkFlowConstants.BUSS_TYPE_YJXXSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 1l){
			bussType =  WorkFlowConstants.BUSS_TYPE_RJXXSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 2l){
			bussType =  WorkFlowConstants.BUSS_TYPE_JKSJXXSJ.toString();
		}
		mapVar.put("bussType",bussType);
		mapVar.put("projectName", yfProjectDesign.getProjectName().toString());
		mapVar.put("projectType", yfProjectDesign.getProjectType().toString());
		mapVar.put("projectOrg", yfProjectDesign.getProjectOrg().toString());
		mapVar.put("projectNo", yfProjectDesign.getProjectNo().toString());
		mapVar.put("ownYear","0");  //概要设计 详细设计 暂时不放  
		CommonUtil.putMapVar(request,mapVar);
		 
		String processId = workFlowCommon.startFlow(WorkFlowConstants.PORCESS_DEFINITION_ONE,CommonUtil.getCurrentUser(request).getId(),mapVar);
	
		yfProjectDesign.setProcessId(processId);
		yfProjectDesign.setAuditStatus(WorkFlowConstants.AUDIT_STATUS_2);
		yfProjectDesign.setOperateid(CommonUtil.getCurrentUser(request).getId());
		yfProjectDesign.setCreateDate(new Date());
		this.yfProjectDesignService.updateObject(yfProjectDesign);
		ActionRedirect redirect = new ActionRedirect(mapping.findForward(Constants.SUCCESS)); 
	    redirect.addParameter("designType", yfProjectDesign.getDesignType());
	    redirect.addParameter("childType", yfProjectDesign.getChildType());
	    return redirect;
	}

	/**
	 * 进入审核页面
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward toAuditYfProjectDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		log.debug("toAuditYfProjectDesign");
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		String bussId = request.getParameter("bussId");
		String processId = request.getParameter("processId");
		String workItemId = request.getParameter("workItemId");
		String auditRole = request.getParameter("auditRole");
		String bussType = request.getParameter("bussType");
		request.setAttribute("auditRole", auditRole);
		request.setAttribute("bussType",bussType);
		yfProjectDesignForm.setId(bussId);
		yfProjectDesign =  yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		yfProjectDesign.setWorkItemId(workItemId);
		request.setAttribute(Constants.YFPROJECTDESIGN, yfProjectDesign);
		examineList(processId,yfExmaineService,request);
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		return mapping.findForward(Constants.SUCCESS);
	}
	
	
	/**
	 * 处理审批 提交流程
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward commandFlowYfProjectDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		log.debug("commandFlowYfProjectDesign");
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesign =  yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		YfExmaine examine = addYfExmaine(yfProjectDesignForm,request);
		Map processVar = new HashMap();
		//不为打回修改完成后提交
		if(!examine.getExamineFlag().equals("modify")){
			yfExmaineService.insertObject(examine);
			if(examine.getExamineFlag().equals(WorkFlowConstants.AUDIT_STATUS_AGREE)){
				processVar.put("approveFlag","agree");
				Usertable user = (Usertable) request.getSession().getAttribute("loginUser");
				String roleName = user.getRoleList().get(0).getName();
				if(roleName.equals(WorkFlowConstants.ROLE_FGFZ)){
					yfProjectDesign.setAuditStatus(WorkFlowConstants.AUDIT_STATUS_3);
					yfProjectDesignService.updateObject(yfProjectDesign);
				}
			}else if(examine.getExamineFlag().equals(WorkFlowConstants.AUDIT_STATUS_DISAGREE)){
				processVar.put("approveFlag","disagree");
				yfProjectDesign.setAuditStatus(WorkFlowConstants.AUDIT_STATUS_4);
				yfProjectDesignService.updateObject(yfProjectDesign);
			}
		}
		
		
		processVar.put("bussId", yfProjectDesign.getId().toString());
		String bussType ="0";
		if(yfProjectDesign.getDesignType().longValue() == 0l){
			bussType =  WorkFlowConstants.BUSS_TYPE_GYSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 0l){
			bussType =  WorkFlowConstants.BUSS_TYPE_YJXXSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 1l){
			bussType =  WorkFlowConstants.BUSS_TYPE_RJXXSJ.toString();
		}
		if(yfProjectDesign.getChildType().longValue() == 2l){
			bussType =  WorkFlowConstants.BUSS_TYPE_JKSJXXSJ.toString();
		}
		processVar.put("bussType",bussType);
		processVar.put("projectName", yfProjectDesign.getProjectName().toString());
		processVar.put("projectType", yfProjectDesign.getProjectType().toString());
		processVar.put("projectOrg", yfProjectDesign.getProjectOrg().toString());
		processVar.put("projectNo", yfProjectDesign.getProjectNo().toString());
		processVar.put("ownYear", "0");
		processVar.put("yfbussTaskType",WorkFlowConstants.BUSS_TASK_TYPE_NORMAL);
		
		/**
		 * 打回修改后需要提交  根据角色决定流程路径
		 */
		CommonUtil.putMapVar(request,processVar);
		processVar.put("yfbussTaskType",WorkFlowConstants.BUSS_TASK_TYPE_NORMAL);
		String workItemId = yfProjectDesignForm.getWorkItemId();
		if(examine.getExamineFlag().equals(WorkFlowConstants.AUDIT_STATUS_REBACK)){
			processVar.put("yfbussTaskType",WorkFlowConstants.BUSS_TASK_TYPE_REBACK);
			//如果记录operatorid 人  的角色为研发经理的时候，回退就需要跳过研发经理审批  流程开始的参数须为 START_YFJL
//			workFlowCommon.commandFlowReback(workItemId, processVar,START_YFJL);
			String operateId = yfProjectDesign.getOperateid();
			if(CommonUtil.isYFJL(operateId)){
				workFlowCommon.commandFlowReback(workItemId, processVar,YfWorkFlowDefine.START_YFJL);
			}else{
				workFlowCommon.commandFlowReback(workItemId, processVar);
			}
		}else{
			workFlowCommon.commandFlow(workItemId, processVar);
		}
		return mapping.findForward(Constants.SUCCESS);
	}
	
	/**
	 * Description: TODO 组合审批意见对象,添加
	 * 
	 * @param form
	 * @param request
	 * @return ActionForward
	 */
	public YfExmaine addYfExmaine(ActionForm form, HttpServletRequest request) {

		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		// 审核标识
		String examineFlag = yfProjectDesignForm.getExamineFlag();
		// 审核意见
		String examineOption = yfProjectDesignForm.getExamineOption();
		String processId = yfProjectDesignForm.getProcessId();
		YfExmaine yfExmaine = new YfExmaine();
		 
		yfExmaine.setId(RandomKey.generateID_Long_19());
		yfExmaine.setExamineFlag(examineFlag);
		yfExmaine.setExamineOption(examineOption);
		yfExmaine.setProcessId(processId);
		yfExmaine.setExamineDate(new Date());
		if(request.getSession().getAttribute("loginUser")!=null){
			Usertable curUser = (Usertable) request.getSession().getAttribute("loginUser");
			yfExmaine.setExaminePerson(curUser.getRname());
			if(curUser.getRoleList().size()>1){
				String roleName = workFlowCommon.getRoleNameByActivityId(yfProjectDesignForm.getWorkItemId());
				yfExmaine.setExamineOrg(roleName);
			}else{
				yfExmaine.setExamineOrg(curUser.getRoleList().get(0).getName()); //无法处理同一个人有多个审批角色
			}
			
		}
		return yfExmaine;
	}
	
	 /*
	 * Description: TODO 查看显示意见
	 * 
	 * @param processInsId
	 * @param examine
	 * @param examineService
	 * @param examineLis
	 * @param request
	 *        void
	 */
	public void examineList(String processInsId, YfExmaineService yfExmaineService, HttpServletRequest request) throws Exception {
		YfExmaineForm yfExmaineForm = new YfExmaineForm();
		yfExmaineForm.setProcessId(processInsId);
		// 审批列表
		List<YfExmaine> examineList = yfExmaineService.searchYfExmaine(yfExmaineForm, null);
		// 防止页面出错
		int resultSize = 0;
		if(examineList != null && !examineList.isEmpty()) {
			resultSize = examineList.size();
		}
		DisplayTagPageBean.getPageBean("examine", resultSize, 0, request);
		request.setAttribute("examineList", examineList);

	}
	
	/**
	 * 到达更新页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward toUpdateIncYfProjectDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		log.debug("toUpdateIncYfProjectDesign");
		String id = request.getParameter("id") == null ? "" : request.getParameter("id").toString();
		YfProjectDesignForm yfProjectDesignForm = (YfProjectDesignForm) form;
		yfProjectDesignForm.setId(id);
		yfProjectDesign =  yfProjectDesignService.searchYfProjectDesign(yfProjectDesignForm, null).get(0);
		request.setAttribute(Constants.YFPROJECTDESIGN, yfProjectDesign);
		request.setAttribute("orgSelect", CommonUtil.getOrgSelectNoZB());
		return mapping.findForward(Constants.SUCCESS);
	}
	
	/**
	 * 更新
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward updateIncYfProjectDesign(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		log.debug("updateIncOutsourceContract");
		String id = request.getParameter("id") == null ? "" : request.getParameter("id").toString();
		YfProjectDesign yfProjectDesign = this.getYfProjectDesign(form);
		yfProjectDesign.setOperateid(CommonUtil.getCurrentUser(request).getId());
		yfProjectDesign.setCreateDate(new Date());
		this.yfProjectDesignService.updateObject(yfProjectDesign);
		PrintWriter out = response.getWriter();
		out.print("<script>window.opener.document.location.reload(); self.close();</script>");
		return null;
	}
	
	
    
        public void setYfProjectDesign(YfProjectDesign yfProjectDesign) {
		this.yfProjectDesign = yfProjectDesign;
	}

		public AttachmentService getAttachmentService() {
			return attachmentService;
		}

		public void setAttachmentService(AttachmentService attachmentService) {
			this.attachmentService = attachmentService;
		}

		public WorkFlowCommon getWorkFlowCommon() {
			return workFlowCommon;
		}

		public void setWorkFlowCommon(WorkFlowCommon workFlowCommon) {
			this.workFlowCommon = workFlowCommon;
		}

		public YfExmaineService getYfExmaineService() {
			return yfExmaineService;
		}

		public void setYfExmaineService(YfExmaineService yfExmaineService) {
			this.yfExmaineService = yfExmaineService;
		}

}
